<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class GoodsModelResource extends JsonResource
{
    const IMAGE_PREFIX = 'https://picture.toysmodel.cn:11443/Inf/EnPic/';
    const THUMBNAIL_PREFIX = 'https://picture.toysmodel.cn:11443/Inf/UpLoad/';

    /**
     * @param $request
     * @return array
     */
    public function toArray($request): array
    {
        return [
            'ID'            => $this->ID,
            'SID'           => $this->SID,
            'PName'         => $this->PName,
            'Picture'       => self::THUMBNAIL_PREFIX . $this->Path . DIRECTORY_SEPARATOR .$this->FName,
            'ToySn'         => $this->ToySn,
            'PClickCount'   => $this->PHotNum,
            'IsRight'       => $this->IsRight,
            'IsNew'         => $this->IsNew,
            'SName'         => $this->SName,
            'skuFlag'       => $this->skuFlag,
            'ITime'         => $this->ITime,
            'PStatus'       => $this->PStatus,
            'url'           => 'https://www.toysnewhome.cn/hbdist/#/?id='.$this->ID,
        ];
    }
}
